SetAxisTorquePid
Configures the PID settings used by an axis in the torque mode.
Syntax
KsError SetAxisTorquePid(
int Index,
McPidSettings Settings
);
Parameters
Index: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Settings: the McPidSettings structure that has all PID settings for the torque mode. You need to fill in every field.
Return value
If the function succeeds, it returns errNoError
, otherwise an error code. For more information about the error code, see the KsError list.
Remarks
- This function can only be used when an axis is power off.
- If you want to use Master Interpolation Torque (
modeMasterIntTor
) or PID Torque (modePidTor
) mode to control the torque sent to the PID, you should use SetAxisControlMode to set an axis's control mode before calling this function.
Example
Copy
McPidSettings torPid = {
1, //KP
0, //KI
0, //KI_LIMIT_PERCENT
10, //KD
0.001, //KV
0.0003, //KAA
0.0003, //KAD
0, //KJ
0.2, //REDUCED_GAIN_DELAY
0.1, //REDUCED_GAIN_FACTOR
TRUE, //KI_STOPPED_ONLY
FALSE, //KD_USE_INTERNAL_ENCODER
0, //MINIMUM_OUTPUT
95 //MAXIMUM_OUTPUT
};
KsError nRet = SetAxisTorquePid(0, torPid);
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksmotion.h | ksmotion.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also